package study.kit.function;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.util.Arrays;
import java.util.List;

@Slf4j
public class GoalUtils_Test {

    //
    List<Goal> list = mock();

    List<Goal> mock() {
        return Arrays.asList(
                Goal.builder().level("3").schoolName("北京八一中学").deptName("初二").build(),
                Goal.builder().level("4").schoolName("北京理工大学").deptName("计算机科学与技术").build()
        );
    }

    @Test
    public void appendByData_test() {
        //
        String schoolNames = GoalUtils.appendByData(list, "schoolName");
        log.info("{}", schoolNames);

        //
        String deptNames = GoalUtils.appendByData(list, "deptName");
        log.info("{}", deptNames);
    }

    @Test
    public void appendByAction_test() {
        //
        String schoolNames = GoalUtils.appendByAction(list, t -> GoalUtils.addPrefix(t.getLevel(), t.getSchoolName()));
        log.info("{}", schoolNames);

        //
        String deptNames = GoalUtils.appendByAction(list, t -> GoalUtils.addPrefix(t.getLevel(), t.getDeptName()));
        log.info("{}", deptNames);
    }

}
